const dburi = 'mongodb://sa:sa@192.168.124.23:27017/test';
const mongoose = require('mongoose');
mongoose.set('useCreateIndex',true);
const con = mongoose.connection;
const colors=require('colors');
con.on('error',(err)=>{
    console.log('mongodb error:'.red);
    console.log(err);
});
con.once('open',()=>{
    console.log('mongodb open success.'.green);
});

mongoose.connect(dburi,{useNewUrlParser:true,useUnifiedTopology:true}).then(()=>console.log('mongodb connect'.green),(err)=>console.log(err));

